//
//  SKRegisterNextView.m
//  SKaURobot
//
//  Created by cdong on 16/2/18.
//  Copyright © 2016年 cdong. All rights reserved.
//

#import "SKRegisterNextView.h"

@implementation SKRegisterNextView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self setView];
    }
    return self;
}

- (void)loadNagavitionViewWithString:(NSString *)nameString{
    self.navigationV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 375*matchW, 64)];
    self.navigationV.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_bg"]];
    [self addSubview:self.navigationV];
    
    self.navigationVL = [[UILabel alloc]initWithFrame:CGRectMake(((self.frame.size.width - 100)/2), 20, 100, 44)];
    self.navigationVL.text = nameString;
    self.navigationVL.textAlignment = NSTextAlignmentCenter;
    self.navigationVL.textColor = [RGBColorEncapsulation colorWithRGB:0xf8f8f8 alpha:1];
    self.navigationVL.font = [UIFont systemFontOfSize:19];
    [self.navigationV addSubview:self.navigationVL];
    //
    self.backBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.backBtn.frame = CGRectMake(12*matchW, CGRectGetMinY(self.navigationVL.frame) + 7, 30, 30);
    [self.backBtn setBackgroundImage:[UIImage imageNamed:@"2left"] forState:UIControlStateNormal];
    [self.navigationV addSubview:self.backBtn];
}

-(void)setView{
    [self loadNagavitionViewWithString:@"注册"];
    self.iconImageV = [[UIImageView alloc]initWithFrame:CGRectMake((12+13.5)*matchW, (17+15)*matchH+44+20, 26*matchW, 26*matchH)];
    self.iconImageV.image = [UIImage imageNamed:@"icon_user"];
    [self addSubview:self.iconImageV];
    self.userNameTF = [[UITextField alloc]initWithFrame:CGRectMake(65*matchW, 17*matchH+20+44, self.frame.size.width - 53*matchW - 12*matchW, 60*matchH)];
    if ([self.userNameTF respondsToSelector:@selector(setAttributedPlaceholder:)]) {
        UIColor *color = [RGBColorEncapsulation colorWithRGB:0xbab9ba alpha:1];
        UIFont *font = [UIFont systemFontOfSize:15];
        self.userNameTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"用户名" attributes:@{NSForegroundColorAttributeName:color,NSFontAttributeName:font}];
    }
    [self addSubview:self.userNameTF];
    self.fillV = [[UIView alloc]initWithFrame:CGRectMake(12*matchW, CGRectGetMaxY(self.userNameTF.frame), self.frame.size.width - 24*matchW, 1*matchH)];
    self.fillV.backgroundColor = [RGBColorEncapsulation colorWithRGB:0xe6e6e6 alpha:1];
    [self addSubview:self.fillV];
    self.pawImageV = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.iconImageV.frame), CGRectGetMaxY(self.fillV.frame) + 15, CGRectGetWidth(self.iconImageV.frame), CGRectGetHeight(self.iconImageV.frame))];
    self.pawImageV.image = [UIImage imageNamed:@"icon_lock"];
    [self addSubview:self.pawImageV];
    self.pawTF = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.userNameTF.frame), CGRectGetMaxY(self.fillV.frame), CGRectGetWidth(self.userNameTF.frame), CGRectGetHeight(self.userNameTF.frame))];
    if ([self.pawTF respondsToSelector:@selector(setAttributedPlaceholder:)]) {
        UIColor *color = [RGBColorEncapsulation colorWithRGB:0xbab9ba alpha:1];
        UIFont *font = [UIFont systemFontOfSize:15];
        self.pawTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"密码" attributes:@{NSForegroundColorAttributeName:color,NSFontAttributeName:font}];
    }
    self.pawTF.secureTextEntry = YES;
    [self addSubview:self.pawTF];
    
    self.pawBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.pawBtn.frame = CGRectMake(CGRectGetMaxX(self.userNameTF.frame) - 18*matchW - 30*matchW, CGRectGetMinY(self.pawImageV.frame)+4*matchH, 26*matchW, 26*matchH);
    [self.pawBtn setBackgroundImage:[UIImage imageNamed:@"icon_eye"] forState:UIControlStateNormal];
    [self addSubview:self.pawBtn];
    
    self.fillV2 = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.fillV.frame), CGRectGetMaxY(self.pawTF.frame), CGRectGetWidth(self.fillV.frame), CGRectGetHeight(self.fillV.frame))];
    self.fillV2.backgroundColor = [RGBColorEncapsulation colorWithRGB:0xe6e6e6 alpha:1];
    [self addSubview:self.fillV2];
    
    self.pawNextImageV = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.iconImageV.frame), CGRectGetMaxY(self.fillV2.frame) + 15, CGRectGetWidth(self.iconImageV.frame), CGRectGetHeight(self.iconImageV.frame))];
    self.pawNextImageV.image = [UIImage imageNamed:@"icon_lock"];
    [self addSubview:self.pawNextImageV];
    
    self.pawNextTF = [[UITextField alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.userNameTF.frame), CGRectGetMaxY(self.fillV2.frame), CGRectGetWidth(self.userNameTF.frame), CGRectGetHeight(self.userNameTF.frame))];
    if ([self.pawNextTF respondsToSelector:@selector(setAttributedPlaceholder:)]) {
        UIColor *color = [RGBColorEncapsulation colorWithRGB:0xbab9ba alpha:1];
        UIFont *font = [UIFont systemFontOfSize:15];
        self.pawNextTF.attributedPlaceholder = [[NSAttributedString alloc]initWithString:@"确认密码" attributes:@{NSForegroundColorAttributeName:color,NSFontAttributeName:font}];
    }
    self.pawNextTF.secureTextEntry = YES;
    [self addSubview:self.pawNextTF];
    
    self.pawNextBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.pawNextBtn.frame = CGRectMake(CGRectGetMaxX(self.userNameTF.frame) - 18*matchW - 30*matchW, CGRectGetMinY(self.pawNextImageV.frame)+4*matchH, 26*matchW, 26*matchH);
    [self.pawNextBtn setBackgroundImage:[UIImage imageNamed:@"icon_eye"] forState:UIControlStateNormal];
    [self addSubview:self.pawNextBtn];
    
    self.fillV3 = [[UIView alloc]initWithFrame:CGRectMake(CGRectGetMinX(self.fillV.frame), CGRectGetMaxY(self.pawNextTF.frame), CGRectGetWidth(self.fillV.frame), CGRectGetHeight(self.fillV.frame))];
    self.fillV3.backgroundColor = [RGBColorEncapsulation colorWithRGB:0xe6e6e6 alpha:1];
    [self addSubview:self.fillV3];
    
    self.registerNextBtn = [UIButton buttonWithType:UIButtonTypeSystem];
    self.registerNextBtn.userInteractionEnabled = NO;
    self.registerNextBtn.frame = CGRectMake(12*matchW, CGRectGetMaxY(self.fillV3.frame)+30*matchH, self.frame.size.width - 24*matchH, 45*matchH);
    self.registerNextBtn.backgroundColor = [RGBColorEncapsulation colorWithRGB:0xcc222a alpha:1];
    [self.registerNextBtn setTitle:@"确定" forState:UIControlStateNormal];
    self.registerNextBtn.titleLabel.font = [UIFont systemFontOfSize:18];
    [self.registerNextBtn setTitleColor:[RGBColorEncapsulation colorWithRGB:0xffffff alpha:.5] forState:UIControlStateNormal];
    [self.registerNextBtn.layer setMasksToBounds:YES];
    [self.registerNextBtn.layer setCornerRadius:3];
    [self addSubview:self.registerNextBtn];
    
    
}

@end
